#include "LuaStackChecker.h"
extern "C" {
#include    <lauxlib.h>
#include    <lualib.h>

}
LuaStackChecker::LuaStackChecker(lua_State* L, const char* filename/* = ""*/,
		int line/* = 0*/) :
	luaState_(L), filename_(filename), line_(line) {
	top_ = lua_gettop(L);
}

LuaStackChecker::~LuaStackChecker() {
	if (top_ != lua_gettop(luaState_)) {
		//ERROR("Lua stack corrupted!")
		luaL_error(luaState_, "Lua stack corrupted! File [%s] line[%d]",
				filename_, line_);
	}
}
